<h1><?php echo $title; ?></h1>
<div class="noprint">
<?php if (isset($notice) || $notice = $this->session->flashdata('notification')):?>
<p class="notice"><?php echo $notice;?></p>
<?php endif;?>

<?php if (!$rows) : ?>
<p class="notice"><?php echo __("Nessuno risultato", $module);?></p>
<?php endif; ?>

<script type="text/javascript">
$(document).ready(function(){
	$("#seleziona").change(function(){
		if($(this).val() == 'tutti')
        {
            $("input:checkbox").attr('checked', true);
        }
        else if($(this).val() == 'stampato')
        {
            $("input:checkbox").attr('checked', false);
            $('input:checkbox[class*="stampato"]').attr('checked', true);
        }
        else if($(this).val() == 'dastampare')
        {
            $("input:checkbox").attr('checked', false);
            $('input:checkbox[class*="dastampare"]').attr('checked', true);
        }
		else
		{
            $("input:checkbox").attr('checked', false);
		}
	});
	$("#elimina").click(function(){
		if (confirm("<?php echo __("Vuoi eliminare i ringraziamenti selezionati?", $module) ?>"))
		{
			return true;
		} else {
			return false;
		}
	});
});
</script>

<form name="form1" method='post' action="<?php echo site_url('adozioni/lettere/ringraziamenti/scegliere') ?>" >
<div class="filter">

<label for="seleziona"><?php echo __("Seleziona", $module) ?></label>
<select id="seleziona">
<option value=""><?php echo __("Niente", $module) ?></option>
<option value="tutti"><?php echo __("Tutti", $module) ?></option>
<option value="stampato"><?php echo __("Stampate", $module) ?></option>
<option value="dastampare"><?php echo __("Non stampate", $module) ?></option>
</select>

<input type="submit" name="stampa" id="stampa" value="<?php echo __("Stampa", $module) ?>" />

<input type="submit" name="elimina" id="elimina" value="<?php echo __("Elimina", $module) ?>" />



</div>

</div>
<table class="list" cellpadding=3 >
	<thead>
		<tr>
				<th width="3%" class="center">#</th>
				<th>ID</th>
				<th><?php echo __("Data Offerta", $module) ?></th>
				<th><?php echo __("Sostenitore", $module)?></th>
				<th><?php echo __("Importo", $module)?></th>
				<th><?php echo __("Categoria", $module)?></th>
				<th><?php echo __("Stampato", $module)?></th>
				<th colspan="3" class="noprint"><?php echo __("Action", $module)?></th>
		</tr>
	</thead>
	<tbody>
<?php if ($rows) : ?>
<?php $i = $start+1; foreach ($rows as $row): ?>
<?php if ($i % 2 != 0): $rowClass = 'odd'; else: $rowClass = 'even'; endif;?>
		<tr class="<?php echo $rowClass?>">
				<td class="center"><?php echo $i?></td>
				<td><input type='checkbox' id="ids<?php echo $row['id'] ?>" name="ids[<?php echo $row['id'] ?>]" class="<?php echo ($row['data_invio'])? "stampato": "dastampare" ?>" value="<?php echo $row['id_sostenitore'] ?>	"></td>
				<td><?php echo data($row['data_offerta']) ?></td>
				<td><?php echo anchor('adozioni/anagrafica/sostenitori/show/'. $row['id_sostenitore'], $row['sostenitore']) ?></td>
				<td><?php echo format_euro($row['valore']) ?></td>
				<td><?php echo $row['categoria'];  if($row['sottocategoria']) echo " - " . $row['sottocategoria'] ?></td>
				<td><?php if($row['data_invio']) echo data($row['data_invio']) ?></td>
				<td class="noprint"><?php echo anchor('adozioni/contabilita/offerte/show/'. $row['id'], __("Visualizza", $module)) ?></td>
				<td class="noprint"><?php echo anchor('adozioni/contabilita/offerte/trash/'. $row['id'], __("Cestino", $module), array('class' => 'delete')) ?></td>
		</tr>
<?php $i++; endforeach; ?>
<?php endif; ?>
</tbody>
</table>	
</form>
<?php echo $pager; ?>
